/*
 * @author: Victor
 * @Date: 2021-08-19 16:01:52
 * @LastEditTime: 2021-08-19 23:24:53
 */
$.ajaxPrefilter(function (options) {
  options.url = 'http://api-breakingnews-web.itheima.net' + options.url;
  if (options.url.indexOf('/my/') !== -1) {
    options.headers = {
      Authorization: localStorage.getItem('token'),
    };
    options.complete = function (res) {
      console.log(res.responseJSON);
      if (res.responseJSON.status == 1) {
        localStorage.removeItem('token');
        location.href = '/login.html';
      }
    };
  }
});
